<template>
  <div class="header">
    <h1>我是Header</h1>
    <p>Count的值是{{ count }},电影的列表总长度是{{ movieList.length }}</p>
    <p>价格是{{ price }}</p>
    <button @click="increment">累加count的值</button>
    <button @click="incrementN({ n: 3 })">count的值每次加n</button>
    <button @click="incrementWait()">等一等再加</button>
    <button @click="incrementNWait({ n: 5 })">等一等再加n</button>
  </div>
</template>

<script>
import { mapMutations, mapState, mapActions } from "vuex";

export default {
  name: "Header",
  computed: {
    ...mapState("count",["count", "price", "movieList"]),
  },
  methods: {
    ...mapMutations("count",["increment", "incrementN"]),
    ...mapActions("count",["incrementWait", "incrementNWait"]),
  },
};
</script>


<style scoped>
.header {
  margin: 30px;
  background: yellowgreen;
}
</style>